$(document).ready(function(){
	var tmp = "Nhập từ cần tìm kiếm";
	// if text input field value is not empty show the "X" button
	$("#field").keyup(function() {
		$("#x").fadeIn();
		if ($.trim($("#field").val()) == "") {
			$("#x").fadeOut();
		}
	}).focus(function(){	
		if(this.value == tmp) this.value = "";
	}).blur(function(){
		if(this.value == "") this.value = tmp;
	});
	
	// on click of "X", delete input field value and hide "X"
	$("#x").click(function() {
		$("#field").val("");
		$(this).hide();
	});
	
	$('input.number').keyup(function(event){		
          if(event.which >= 37 && event.which <= 40){
              event.preventDefault();
          }          
          var num = $(this).val().replace(/,/g, '');          
          $(this).val(num.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"));
	});
});